<?php
session_start();

$groupName = $_GET['group_name'] ?? null;
if (!$groupName) die("未指定群聊名称！");
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>群聊菜单 - <?= htmlspecialchars($groupName) ?></title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            -webkit-tap-highlight-color: transparent;
        }
        
        body {
            background-color: #f5f7fa;
            color: #333;
            min-height: 100vh;
        }
        
        /* 灰色顶栏 */
        .navbar {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            background: #f0f2f5;
            color: #333;
            padding: 15px 20px;
            display: flex;
            align-items: center;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            z-index: 100;
            border-bottom: 1px solid #e0e4e9;
        }
        
        .back-btn {
            background: none;
            border: none;
            color: #555;
            font-size: 20px;
            margin-right: 15px;
            cursor: pointer;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }
        
        .back-btn:hover {
            background: #e4e6eb;
        }
        
        .navbar-title {
            font-size: 18px;
            font-weight: 600;
            flex-grow: 1;
            color: #333;
        }
        
        /* 主内容区 */
        .content {
            margin-top: 70px; /* 导航栏高度 */
            padding: 20px;
            max-width: 600px;
            margin-left: auto;
            margin-right: auto;
            width: 100%;
        }
        
        .group-header {
            text-align: center;
            padding: 20px 0;
            margin-bottom: 20px;
        }
        
        .group-name {
            font-size: 24px;
            font-weight: 700;
            color: #2d3748;
            position: relative;
            display: inline-block;
            padding-bottom: 10px;
        }
        
        .group-name::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 80px;
            height: 3px;
            background: linear-gradient(90deg, #3498db, #2ecc71);
            border-radius: 3px;
        }
        
        /* 菜单按钮 */
        .menu-container {
            background-color: white;
            border-radius: 12px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.05);
            overflow: hidden;
        }
        
        .menu-item {
            display: flex;
            align-items: center;
            padding: 18px 25px;
            text-decoration: none;
            color: #333;
            border-bottom: 1px solid #f0f2f5;
            transition: all 0.3s ease;
        }
        
        .menu-item:last-child {
            border-bottom: none;
        }
        
        .menu-item:hover {
            background-color: #f8f9fa;
            transform: translateY(-2px);
        }
        
        .menu-icon {
            width: 46px;
            height: 46px;
            background: linear-gradient(135deg, #f0f2f5, #e4e6eb);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 20px;
            font-size: 20px;
            color: #4267B2;
            transition: all 0.3s ease;
        }
        
        .menu-item:hover .menu-icon {
            background: linear-gradient(135deg, #3498db, #2ecc71);
            color: white;
            transform: scale(1.1);
        }
        
        .menu-text {
            flex-grow: 1;
        }
        
        .menu-title {
            font-size: 17px;
            font-weight: 600;
            color: #2d3748;
        }
        
        .menu-desc {
            font-size: 14px;
            color: #718096;
            margin-top: 5px;
        }
        
        /* 响应式调整 */
        @media (max-width: 768px) {
            .content {
                padding: 15px;
            }
            
            .menu-item {
                padding: 16px 20px;
            }
            
            .menu-icon {
                width: 42px;
                height: 42px;
                font-size: 18px;
            }
            
            .group-name {
                font-size: 22px;
            }
        }
        
        @media (max-width: 480px) {
            .navbar {
                padding: 12px 15px;
            }
            
            .back-btn {
                font-size: 18px;
                width: 32px;
                height: 32px;
            }
            
            .navbar-title {
                font-size: 16px;
            }
            
            .content {
                margin-top: 60px;
            }
            
            .group-name {
                font-size: 20px;
            }
            
            .menu-item {
                padding: 14px 16px;
            }
            
            .menu-icon {
                width: 38px;
                height: 38px;
                margin-right: 15px;
            }
        }
    </style>
</head>
<body>
    <!-- 灰色顶栏 -->
    <div class="navbar">
        <button class="back-btn" onclick="history.back()">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="navbar-title">群聊菜单</div>
    </div>
    
    <!-- 主内容区 -->
    <div class="content">
        <div class="group-header">
            <div class="group-name"><?= htmlspecialchars($groupName) ?></div>
        </div>
        
        <div class="menu-container">
            <a href="#" class="menu-item" onclick="confirmExitGroup(event)">
                <div class="menu-icon">
                    <i class="fas fa-sign-out-alt"></i>
                </div>
                <div class="menu-text">
                    <div class="menu-title">退出群聊</div>
                    <div class="menu-desc">离开这个群聊</div>
                </div>
            </a>
            
            <a href="qllist.php?group_name=<?= urlencode($groupName) ?>" class="menu-item">
                <div class="menu-icon">
                    <i class="fas fa-users"></i>
                </div>
                <div class="menu-text">
                    <div class="menu-title">群成员列表</div>
                    <div class="menu-desc">查看所有成员</div>
                </div>
            </a>
            
            <a href="qlgl.php?group_name=<?= urlencode($groupName) ?>" class="menu-item">
                <div class="menu-icon">
                    <i class="fas fa-cog"></i>
                </div>
                <div class="menu-text">
                    <div class="menu-title">管理群</div>
                    <div class="menu-desc">群设置和权限管理</div>
                </div>
            </a>
            
            <a href="qlinfo.php?group_name=<?= urlencode($groupName) ?>" class="menu-item">
                <div class="menu-icon">
                    <i class="fas fa-info-circle"></i>
                </div>
                <div class="menu-text">
                    <div class="menu-title">群资料卡</div>
                    <div class="menu-desc">查看群聊信息</div>
                </div>
            </a>
        </div>
    </div>
    
    <script>
        // 退出群聊的二级验证
        function confirmExitGroup(event) {
            event.preventDefault();
            const groupName = "<?= htmlspecialchars($groupName) ?>";
            
            if (confirm(`确定要退出 "${groupName}" 群聊吗？\n\n退出后将无法接收该群消息，且需要重新加入才能参与聊天。`)) {
                // 用户确认退出，执行跳转
                window.location.href = "outql.php?group_name=" + encodeURIComponent(groupName);
            }
        }
    </script>
</body>
</html>